const workerA=new Worker("./workerA.js")
const workerB=new Worker("./workerB.js")

const channel=new MessageChannel();

workerA.postMessage({port:channel.port1,message:"来自主线程的消息 to Worker A"},[channel.port1])
workerB.postMessage({port:channel.port2,message:"来自主线程的消息 to Worker B"},[channel.port2])

workerA.onmessage=({data})=>console.log(data);
workerB.onmessage=({data})=>console.log(data);